﻿using System.Collections.Generic;
using System.Configuration;
using System.Linq;

namespace SwissTV.Entities.Social
{
    public class SocialConfigSection : System.Configuration.ConfigurationSection
    {
        [ConfigurationProperty("socialconfigs")]
        [ConfigurationCollection(typeof(SocialConfigCollection), AddItemName = "socialconfig")]
        public SocialConfigCollection SocialConfigs
        {
            get
            {
                return (SocialConfigCollection)this["socialconfigs"];
            }
            set
            {
                 this["socialconfigs"] = value;
            }
        }

        public List<SocialConfig> getSocialConfigs()
        {
            return SocialConfigs.Cast<SocialConfigElement>().Select(p => new SocialConfig(p.Authentication.getAuthentication(), p.Urls.getUrls())).ToList();
        }
    }
}

